package ui.newgamescreen;

import java.awt.Component;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerModel;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class NumberSpinner extends JSpinner{

	public NumberSpinner(SpinnerModel model) {
		this.setModel(model);
		this.getEditor().addKeyListener(new java.awt.event.KeyAdapter(){
	    @Override
	     public void keyTyped(KeyEvent arg0)
	     {
	       if (!Character.isDigit(arg0.getKeyChar())){
	         arg0.consume();    
	       }
	     }});
	}

}
